package com.junzhiit.nengji.cms.feign.agent.fallback;

import org.springframework.stereotype.Component;

import com.junzhiit.nengji.cms.feign.agent.AgentFeignService;
import com.junzhiit.nengji.cms.service.impl.BaseServiceImpl;
import com.junzhiit.nengji.cms.web.util.CMSCodeStatus;
import com.intranet.transport.object.ResultTO;

import feign.hystrix.FallbackFactory;

@Component
public class AgentFeignFallback extends BaseServiceImpl implements FallbackFactory<AgentFeignService> {

	@Override
	public AgentFeignService create(Throwable cause) {
		return new AgentFeignService() {
			@Override
			public ResultTO switchActivationStatus(String systemId, int status) {
				logger.error("调用微服务失败！");
				logger.error(cause.getMessage());
				return new ResultTO(CMSCodeStatus.FAILED, "代理商激活服务暂时不可用, 请稍后再试");
			}
		};
	}
}
